﻿Imports HMSLibrary

Public Class ReportWindow

    Dim _ID As Integer
    Public WriteOnly Property ID As Integer
        Set(ByVal value As Integer)
            _ID = value
        End Set
    End Property

    Dim rpt As ReportViewerUserControl
    Private Sub ReportWindow_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
        rpt = WindowsFormsHost1.Child
        rpt.ReportType = Me.ReportType
        rpt.ID = 11 '_ID
        If Me.ReportType = ReportsList.BillCumReceipt Then
            FilterGrid.Visibility = Visibility.Collapsed
            rpt.SetReport()
        Else
            StartDatePicker.DisplayDateEnd = Date.Now
            EndDatePicker.DisplayDateEnd = Date.Now
        End If
    End Sub


    Private Sub MainWindow_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Input.MouseButtonEventArgs) Handles Me.MouseDown
        DragMove()
    End Sub

    Private Sub CloseButton_Click(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles CloseButton.Click
        Me.Close()
    End Sub

    Private Sub MinimizeButton_Click(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles MinimizeButton.Click
        Me.WindowState = Windows.WindowState.Minimized
    End Sub

    Public Property ReportType As ReportsList

    Private Sub StartDatePicker_CalendarClosed(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles StartDatePicker.CalendarClosed
        rpt.StartDate = StartDatePicker.SelectedDate
    End Sub

    Private Sub PreviewButton_Click(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles PreviewButton.Click
        rpt.SetReport()
    End Sub

    Private Sub EndDatePicker_CalendarClosed(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles EndDatePicker.CalendarClosed
        rpt.EndDate = EndDatePicker.SelectedDate
    End Sub
End Class
